<?php
/**
 * Created by PhpStorm.
 * User: necis.zhang
 * Date: 27/07/16
 * Time: 上午 10:50
 */
header("Content-type:text/html;charset=utf-8");
include_once('Model.class.php');
$randomNum=50;

function rand_num(&$num)
{
    $n = rand(100000,999999);
    if(in_array($n,$num))
    {
        rand_num($num);
    }
    return $n;
}
$num= array();
for($i=0;$i<$randomNum;$i++)
{
    $num[] = '1d'.rand_num($num);
}

sort($num);
//var_dump($num);
$data=array();

for($i=0;$i<$randomNum;$i++){
    $data[$i]['sessionid']=$num[$i];
}
//var_dump($data);
//$model = M('game_id');
//$result = $model->addAll($data);
//var_dump($result);